import { defineStore } from "pinia";

export const useToken = defineStore("token", {
  state: () => ({
    token: "",
    areaId: ""
  }),
  getters: {
    getToken: state => {
      return state.token;
    },
    getAreaId: state => {
      return state.areaId;
    }
  },
  actions: {
    setToken(token: string) {
      const that = this;
      that.token = token;
    },
    removeToken() {
      const that = this;
      that.token = "";
    },
    setAreaId(areaId: string) {
      const that = this;
      that.areaId = areaId;
    },
    removeAreaId() {
      const that = this;
      that.areaId = "";
    },
  }
});
